package com.xlh.wjdcserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.property.dto.AssignRoleDTO;
import com.property.dto.UserLoginDTO;
import com.property.entity.User;
import com.property.vo.RoleVO;
import com.property.vo.UserVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    List<String> checkQid(String commId);

    Page<UserVO> getUserPage(Page<UserVO> page);

    @Insert("insert into role_user(user_id,role_id) values(#{userId},#{roleId})")
    void assignRole(AssignRoleDTO assignRoleDTO);

    @Select("select * from role_user where user_id=#{userId}")
    List<RoleVO> getRoleByUserId(String userId);

    @Delete("delete from role_user where user_id=#{userId}")
    void deleteRole(String userId);
}
